﻿using System;
using System.Collections.Generic;
using System.Text;
using DataAccess; 
using System.Data;
using Entity;

namespace BusinessObject
{
    public class CategoriesBO
    {
        CategoriesDA cDA = new CategoriesDA();
        public DataSet getCategory()
        {
            DataSet dt = cDA.getCategories();
            return dt;
        }

        public bool createCategory(string name, string type, string description)
        {
            Category c = new Category();
            c.Category_Name = name;
            c.Category_Type = type;
            c.Category_Description = description;

            if (cDA.CreateCategories(c))
            {
                return true;
            }
            return false;
        }

        public DataSet selectCategoryByType(string type)
        {
            DataSet dt = cDA.getCategoriesByType(type);
            return dt;
        }

        public Category selectCategoryByID(int n)
        {
            Category c = cDA.getCategoriesByID(n);
            return c;
        }

        public bool updateCategory(Category c)
        {
            if (cDA.UpdateCategories(c))
            {
                return true;
            }
            return false;
        }
        public bool removeCategory(Category c)
        {
            if (cDA.DeleteCategory(c))
            {
                return true;
            }
            return false;
        }
    }
}
